//引入的express
var express=require('express');
var multer = require('multer'); // v1.0.5
var storage = multer.diskStorage({
    destination(req, file, cb) {
        cb(null, './public/image/qlzimg')
    },
    filename(req, file, cb) {
        var arr=file.originalname.split('.');
        cb(null, file.originalname)
    }
});
var upload = multer({
    storage: storage
});


//引入controller
var qlzController=require('./../controller/qlzController.js');
//只执行express里面的router模块
var qlzRouter=express.Router();
/*详情*/
qlzRouter.get('/gameTypeTable',qlzController.gameTypeTable);
qlzRouter.get('/giftTypeTable',qlzController.giftTypeTable);
/*删除*/
qlzRouter.post('/deleteTable',qlzController.deleteTable);
qlzRouter.post('/giftDelete',qlzController.giftDelete);
/*添加*/
qlzRouter.post('/addTableValue',qlzController.addTableValue);
qlzRouter.post('/giftAdd',qlzController.giftAdd);
/*修改*/
qlzRouter.post('/modifyTableValue',qlzController.modifyTableValue);
qlzRouter.post('/giftModify',qlzController.giftModify);
/*搜索*/
qlzRouter.post('/searchValue',qlzController.searchValue);
qlzRouter.post('/giftSearch',qlzController.giftSearch);

qlzRouter.post('/upload',upload.single( 'files'),(req,res)=>{
    res.send({data:res.req.file.originalname});
        console.log(res.req.file.originalname)
});
//导出模块
module.exports=qlzRouter;